<script src='__STYLE__/Site/js/swipe.min.js'></script>
<script src='__STYLE__/Site/js/js.js'></script>
<div class="header">
    <div class="addWrap" >
      <div class="swipe" id="mySwipe">
        <div class="swipe-wrap" id="swipe-wrap-box">
          <tag:productSlide id="vo" >
             <div>
              <a href=" {$vo.url}">
                <img class="img-responsive" src=" {$vo.img}"/>
              </a>
          </div>
          </tag:productSlide>     
        </div>
      </div>
      <ul id="position">
      </ul>
    </div>
  </div>


<section class="product-block product-list clearfix mt10 pl10 pr10 p20">
  <a href="#"><h4 class="lm">{$category.name}</h4></a>
   <div class="content img-cont">
    <ul>
	    <tag:productGoods id="vo" order="create_time desc" limit="10">
	              <li>
	                <a href="{$vo.url}">
	                    <img src="{$vo.thumb_img}" />
	                    <div class="content-n">
	                    <span>{$vo.name}</span>
	                       <p class="cost-p"><span>￥{$vo.price}</span></p>
	                      <p>月销量：{$vo['saled_count']+$vo['saled_base']}</p>
	                    </div>
	                </a>
	              </li>  
	    </tag:productGoods>
	  </ul>
	 </div>
  <button id="read-more" class="btn btn-orange w100" style=" background: {$style.bottom_bg}; color: {$style.bottom_color};">加载更多</button>
</section>
<!-- 产品列表 End -->
<script type="text/javascript">
  (function(){
    var readMoreBtn = document.getElementById ( "read-more" ),
        productGoodsList = document.getElementById ( "product-goods-list" ),
        page = 1,
        id = {$_GET['id']},
        sid = {$sid};
    readMoreBtn.addEventListener ( "touchend", fnReadMore, false );

    function fnReadMore () {

      readMoreBtn.innerHTML = "加载中……";
      readMoreBtn.classList.add ( "disabled" );
      readMoreBtn.removeEventListener ( "touchend", fnReadMore, false );

      GH.ajax ( "__CONTROLLER__/more", {"p": ++page, "id": id, "sid": sid}, function(data){
        fnShowMore(data);
        if ( data.extra.length == 0 ) {
          readMoreBtn.innerHTML = "已经没有更多了~";
        } else {
          readMoreBtn.innerHTML = "加载更多";
          readMoreBtn.classList.move ( "disabled" );
          readMoreBtn.addEventListener ( "touchend", fnReadMore, false );
        }
      }, "post" );

    };
    function fnShowMore ( data ) {
      var html = "";
      for ( var i=0; item=data.extra[i]; i++ ) {
        html += "<li class='mb8'><a href='"+ item.url +"'>"
               +"<p class='preview'><img src='"+ item.pic +"'></p>"
               +"<p class='title mt5'>"+ item.name +"</p>"
               +"<p class='price'><span>￥"+ item.price +"</span><del>"+ item.price_high +"</del></p>"
               +"</a></li>"
      };
      productGoodsList.insertAdjacentHTML ( "beforeend", html );
    };
  })();
</script>
